﻿using System;
using System.ComponentModel;
using System.IO.IsolatedStorage;
using WindowsPhoneEssentials.Abstractions;
using WindowsPhoneEssentials.ComponentModel;
using WindowsPhoneEssentials.Settings;

namespace SampleApplication
{
    public partial class Settings
    {
        public Settings()
        {
            DataContext = this;
            ApplicationSettings = new SettingsProvider(new IsolatedStorageSettingsWrapper(IsolatedStorageSettings.ApplicationSettings))
                .GetSettings<ApplicationSettings>();
            InitializeComponent();
        }

        public ApplicationSettings ApplicationSettings { get; set; }
    }

    public class ApplicationSettings : NotifyPropertyChanged, ISettings
    {
        [DefaultValue(5)]
        [DisplayName("Number Results")]
        public int NumberResults { get; set; }

        public string Nickname { get; set; }

        [DefaultValue(true)]
        [DisplayName("Enable Stuff")]
        public bool EnableStuff { get; set; }

        public DateTime? Birthday { get; set; }

        [DisplayName("Some Options")]
        public Options SomeOptions { get; set; }
    }

    public enum Options
    {
        Value1, 
        Value2
    }
}